package com.itsu.api.controllerApi;

import com.itsu.commons.annotations.MyCache;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;
import java.io.IOException;

@RequestMapping("movements")
public interface PublishControllerApi {
    /**
     * 发布动态
     * @param textContent
     * @param location
     * @param latitude
     * @param longitude
     * @param multipartFiles
     * @return
     * @throws IOException
     */
    @PostMapping
    ResponseEntity publishQunzi(@RequestParam("textContent") String textContent,
                                @RequestParam(value = "location", required = false) String location,
                                @RequestParam(value = "latitude", required = false) String latitude,
                                @RequestParam(value = "longitude", required = false) String longitude,
                                @RequestParam(name = "imageContent", required = false) MultipartFile[] multipartFiles) throws IOException;

    /**
     * 查看朋友圈
     * @param page
     * @param pagesize
     * @return
     */
    @GetMapping
    @MyCache(timeout = 120)
    ResponseEntity friendsQunzi(@RequestParam("page") Integer page,@RequestParam("pagesize") Integer pagesize);

    /**
     * 查看推荐朋友圈
     * @param page
     * @param pagesize
     * @return
     */
    @GetMapping("recommend")
    ResponseEntity recommendFriendQunzi(@RequestParam("page") Integer page,@RequestParam("pagesize") Integer pagesize);

    /**
     * 查看自己朋友圈 （包括其它人）
     * @param page
     * @param pagesize
     * @param userId
     * @return
     */

    @GetMapping("all")
    public ResponseEntity mySelfFriendQunzi(@RequestParam(value = "page", defaultValue = "1") Integer page,
                                         @RequestParam(value = "pagesize", defaultValue = "10") Integer pagesize,
                                         @RequestParam(value = "userId") Long userId);
}
